package com.martian.common.util;

/**
 * @author martian
 * @version V1.0.0
 * @Description
 * @date 2023-05-13 22:42
 */

public class ABTest {
    private static int trafficSplitNumber = 3;
    private static String bucketBaseModel = "emb";
    private static String bucketAModel = "NeuralCF";
    private static String bucketBModel = "DeepCrossing";
    private static String bucketCModel = "WideAndDeep";

    public static String getModelByUserId(String userId){
        if(userId == null || userId.isEmpty()){
            return bucketAModel;
        }
        if(userId.hashCode() % trafficSplitNumber ==0){
            return bucketBaseModel;
        }else if(userId.hashCode() % trafficSplitNumber ==1){
            return bucketAModel;
        }else if(userId.hashCode() % trafficSplitNumber ==2){
            return bucketBModel;
        }else{
            return bucketCModel;
        }
    }

    public static void main(String[] args) {
        for(int i=0;i<600;i++){
            System.out.println(String.valueOf(i).hashCode());
        }
//        System.out.println("23".hashCode());
    }
}
